package cn.tedu.tw.whr.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class AppJdbcUpdate {
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/test?useSSL=false";
        String username = "root";
        String password = "root";
        Connection connection = DriverManager.getConnection(url,username,password);
        Statement statement = connection.createStatement();

        String sql = "UPDATE `user` SET username = 'wyy' WHERE username = 'Tom'";

        int i = statement.executeUpdate(sql);
        if (i>0){
            System.out.printf("修改成功");
        }

    }
}
